<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Read File</title>
</head>
<body>
  <input type="file" id="file"/>
  
  <script>
    const file = document.getElementById('file')
    const r = new FileReader()
    
    file.addEventListener('change', uploadFileHandler)

    function uploadFileHandler(e) {
      r.readAsText(this.files[0])
      r.onloadend = function () {
        console.log(r.result)
      }
    }
  </script>
</body>
</html>